﻿/*****************************************************************************\
 *             University of Illinois/NCSA Open Source License
 *
 * 
 *      Copyright © 2012,2013, The Board of Trustees of the University of Illinois. All rights reserved.
 *
 *      Developed by: Rakesh Bobba, Derek Dagit, Erich Heine, Denis Kholine,
 *                    Klara Nahrstedt, David Rodgers,   William H. Sanders, Tim Yardley
 *
 *      Information Trust Institute/Coordinated Science Laboratory
 * 
 *      University of Illinois
 *      
 *      The Board of Trustees of the University of Illinois
 *      109 Coble Hall
 *      801 South Wright Street
 *      Champaign, IL 61820-6242
 *
 *      http://www.iti.illinois.edu / http://csl.illinois.edu
 * 
 *      Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 
 *      associated documentation files (the “Software”), to deal with the Software without restriction, 
 *      including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
 *      and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
 *      subject to the following conditions:
 *
 *      Redistributions of source code must retain the above copyright notice, this list of conditions and the
 *      following disclaimers.
 *      
 *      Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
 *      the following disclaimers in the documentation and/or other materials provided with the distribution.
 *
 *      Neither the names of Information Trust institute, Coordinated Science Laboratory, University of Illinois,
 *      The Board of Trustees of the University of Illinois nor the names of its contributors may be used to 
 *      endorse or promote products derived from this Software without specific prior written permission.
 *      
 *      THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 *      LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN
 *      NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 *      WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
 *      SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
 *      
 \*****************************************************************************/

 using System;
using SIEGate.Core.Measurements;
 using SIEGate.Core.Stats;

namespace SIEGate.Core.Adapters
{
    public abstract class OutputAdapter : AdapterBase
    {
        public override void link(IAdapter other)
        {
            throw new NotImplementedException("Output Adapters must be last!");
        }

        protected OutputAdapter(IAdapterInfo conf) : base(conf)
        {
            m_statsCluster.RegisterCounter(conf.Name, StringConstants.EmittedRawData);
            // Number of remote systems connected to this OutputAdapter.
            // TODO: Find usages.
            //m_statsCluster.RegisterCounter(conf.Name, StrStatConnectedClients);
            m_statsCluster.RegisterCounter(conf.Name, StringConstants.ProcessedMeasurements);

            // Example stats used by extensions of OutputAdapter
            // Most of these stats need to be included in extensions of
            // OutputAdapter.  For things that don't expect some number of
            // measurements, we shouldn't be tracking "expected measurements"
            // for instance.  But these are the sorts of things that should
            // be included when available.
            //m_statsCluster.RegisterCounter(conf.Name, StrStatDiscardedMeasurements);
            //// Not sure if this belongs here.
            //m_statsCluster.RegisterCounter(conf.Name, StrStatReceivedMeasurements);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatExpectedMeasurements);
            //// This definitely seems like the wrong place for this; output adapter shouldn't be doing any processing at all
            //m_statsCluster.RegisterCounter(conf.Name, StrStatProcessedMeasurements);
            //// I'm not even sure what this stat is
            //m_statsCluster.RegisterCounter(conf.Name, StrStatMeasurementsSortedByArrival);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatPublishedMeasurements);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatDownsampledMeasurements);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatMissedSortsByTimeout);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatFramesAheadOfSchedule);
            //m_statsCluster.RegisterCounter(conf.Name, StrStatPublishedFrames);
        }
    }
}
